package com.qrxl.commond;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Objects;

/**
 * @author LiuYing
 * @version 1.0
 * @date 20/12/27 下午 10:33
 */
public class LocalFileCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        Environment environment = conditionContext.getEnvironment();
        String fileServieName = environment.getProperty("custom.fileImplInstance");
        if (!Objects.equals("aliOssFileStoreServiceImpl",fileServieName)) {
            return true;
        }
        return false;
    }
}